<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>ruoyi-plus论坛</title>
    <meta name="format-detection" content="telephone=no">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="/forum/css/main.min.css">
    <link rel="bookmark" type="image/x-icon" href="forum/images/favicon.ico">
    <link rel="shortcut icon" type="image/x-icon" href="forum/images/favicon.ico">
    <link  th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link rel="stylesheet" href="/forum/bbs/common.css">
    <link rel="stylesheet" href="/forum/bbs/index.css">
    <link rel="stylesheet" href="/forum/css/mystyle.css">
    <link rel="stylesheet" href="/forum/css/hellorf.css">
    <link rel="stylesheet" href="/forum/css/yzm_bbs_index.css">
    <link rel="stylesheet" href="/forum/bbs/iconfont.css">
    <script type="text/javascript" src="/forum/lib/jquery.min.js"></script>
<style>
    #body{background: #f4f4f4;    padding-bottom: 170px;}
    .clear{clear:both;}
    .yzm_list h3 a.top{color:red;}
    .yzm_list h3 a.good{color:#FF5722;}
    .yzm_list h3 a.recommend{color:#5FB878;}



</style>
</head>
<body style="">
<div id="body">
    <div th:replace="forum/header_index"></div>

    <div class="searchbox" style="display: none;">
        <div class="search">
            <form action="/forum/search" method="get" name="searchform" id="searchform">
                <input name="content" id="content" class="input_text" value="请输入关键字词" style="color: rgb(153, 153, 153);" onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}" onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}" type="text">

                <input class="input_submit" type="submit" style="cursor: pointer">
            </form>
        </div>
        <div class="searchclose"></div>
    </div>

    <!--*******************************-->
   <!-- <main class="main-wrapper">-->

        <div class="yzm_main container">
            <div class="yzm_main_left">
                <div class="yzm_list_section">
                    <strong>置顶</strong>
                    <ul class="yzm_list">
                        <li th:each="item:${@forum.selectTopQuestion()}">
                            <a th:href="@{'/forum/u/'+${item.yhid}}" target="_blank" class="yzm_avatar" th:title="${item.author}">
                                <img th:src="${item.avatar}" th:alt="${item.author}">
                            </a>

                            <h3>
                                <span class="yzm_badge" th:text="${item.forumCategoryName}"></span>
                                <a th:href="@{'/forum/question/questionDetail/'+${item.id}}" th:data-id="${item.id}" onclick="return checkAuth(this)" target="_blank" th:text="${item.title}"></a>
                                <!--<i th:if="${not #strings.isEmpty(item?.attachment)}" style="display:inline-block;width: 25px;height: 25px;background-size: 25px 25px;background: url('/forum/images/attachment.png') no-repeat center"></i>-->
                                <span th:if="${not #strings.isEmpty(item?.attachment)}"   class="hideTagType hide_4" data="4">
                                    <!--有附件-->
		                      		<i class="fa fa-clipboard"> </i>
			                    </span>

                                <span th:if="${item?.hideType==1 and user==null}"  class="hideTagType hide_1" data="1">
                                    <!--登录后可见-->
		                      		<i class="fa fa-lock"> </i>
			                    </span>
                                <span th:if="${item?.hideType==2}"  class="hideTagType hide_2" data="2">
                                    <!--达到等级可见-->
		                      		<i class="fa fa-lock"> </i>
			                    </span>
                                <span th:if="${item?.downloadType==2}"  class="hideTagType hide_3" data="3">
                                    <!--积分购买可见-->
		                      		<i style="left: 4px;top: 0px;" class="fa fa-shopping-cart"> </i>
			                    </span>
                            </h3>
                            <div class="yzm_list_info">
                                <a th:href="@{'/forum/u/'+${item.yhid}}" target="_blank">
                                    <cite th:text="${item.author}"></cite>
                                </a>
                                <span class="yzm_time" th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></span>
                                <span class="yzm_list_nums">

                                    <span class="yzm_browse" title="浏览次数"><img src="/forum/images/browse.png" alt="浏览次数">[[${item.hit}]]次</span>
                                    <span class="yzm_comment" title="评论次数"><img src="/forum/images/comment.png" alt="评论次数">[[${item.commentNum}]]</span>
                                </span>
                            </div>
                            <div class="yzm_list_badge">
                                <span class="yzm_badge yzm_stick">置顶</span>
                            </div>
                        </li>

                    </ul>
                </div>

                <div class="yzm_list_section">
                    <strong>最新</strong>
                    <ul class="yzm_list">
                        <li th:each="item:${@forum.selectNew20Question()}">
                            <a th:href="@{'/forum/u'+${item.yhid}}" target="_blank" class="yzm_avatar" th:title="${item.author}">
                                <img th:src="${item.avatar}" th:alt="${item.author}">
                            </a>

                            <h3>
                                <span class="yzm_badge" th:text="${item.forumCategoryName}"></span>
                                <a th:if="${item.questionRegion=='top'}" class="top" th:href="@{'/forum/question/questionDetail/'+${item.id}}" target="_blank" th:text="${item.title}"></a>
                                <a th:if="${item.questionRegion=='good'}" class="good" th:href="@{'/forum/question/questionDetail/'+${item.id}}" target="_blank" th:text="${item.title}"></a>
                                <a th:if="${item.questionRegion=='recommend'}" class="recommend" th:href="@{'/forum/question/questionDetail/'+${item.id}}" target="_blank" th:text="${item.title}"></a>
                                <a th:unless="${item.questionRegion}"  th:href="@{'/forum/question/questionDetail/'+${item.id}}" target="_blank" th:text="${item.title}"></a>

                            </h3>
                            <div class="yzm_list_info">
                                <a th:href="@{'/forum/u/'+${item.yhid}}" target="_blank">
                                    <cite th:text="${item.author}"></cite>
                                </a>
                                <span class="yzm_time" th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></span>
                                <span class="yzm_list_nums">
                                    <span class="yzm_browse" title="浏览次数"><img src="/forum/images/browse.png" alt="浏览次数">[[${item.hit}]]次</span>
                                    <span class="yzm_comment" title="评论次数"><img src="/forum/images/comment.png" alt="评论次数">[[${item.commentNum}]]</span>
                                </span>
                            </div>
                            <div class="yzm_list_badge">
                                <span class="yzm_badge yzm_stick" th:if="${item.questionRegion=='top'}">置顶</span>
                                <span class="yzm_badge yzm_essence"  th:if="${item.questionRegion=='good'}">精品</span>
                                <span class="yzm_badge yzm_recomm"  th:if="${item.questionRegion=='recommend'}">推荐</span>
                            </div>
                        </li>

                    </ul>
                </div>
            </div>
            <div class="yzm_main_right">
                <div th:replace="forum/sidebar_index"></div>
            </div>

            <div class="clear"></div>
        </div>
    <!--</main>-->
    <!--*******************************-->

    <div th:replace="forum/footer"></div>
</div>
<div class="shade hide"></div>

<script type="text/javascript" src="/forum/js/common.js"></script>
<script th:inline="javascript"> var ctx = [[@{/}]];</script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ruoyi/js/fast.js}"></script>
<script>
    //nav
    $("#mnavh").click(function(){
        $(".searchbox").toggleClass("open");
    });
    //searchclose
    $(".searchclose").click(function(){
        $(".searchbox").removeClass("open");
    });

    var isLogin='[[${user!=null}]]';

    function daySign(){
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }
        $.ajax({
            type: "post",
            url: ctx+"userSign",
            data: null,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                if(data.code==0||data.code=='0'){
                    layer.msg(data.msg);
                    setTimeout(function(){
                        window.location.reload();
                    },1000);
                }else{
                    Fast.msg_error(data.msg);
                }
            }
        })
    }
    function openAddQuestion(){
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }
        window.location.href=ctx+"uploadQuestion"
    }

    $(function(){

    });
    function openRule(){
        var url=ctx+"forum/signRule";

        open_page("签到规则说明",url,600,370)
    }


    function open_page(title,url,w,h){
        if (title == null || title == '') {
            title=false;
        };
        if (url == null || url == '') {
            url="404.html";
        };
        if (w == null || w == '') {
            w=800;
        };
        if (h == null || h == '') {
            h=($(window).height() - 50);
        };
        layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: false,
            shade:0.4,
            title: title,
            content: url
        });
    }


    var tip_index = 0;
    $(".hideTagType").on('mouseenter', this,function() {
        var hideTagType = $(this).attr("data");
        var hideTagValue = "";
        if(hideTagType == 0){
            //hideTagValue = "输入密码可见";
        }else if(hideTagType == 1){
            hideTagValue = "登录后可浏览";
        }else if(hideTagType == 2){
            hideTagValue = "达到等级可见";
        }else if(hideTagType == 3){
            hideTagValue = "附件积分下载";
        }else if(hideTagType == 4){
            hideTagValue = "该帖子有附件";
        }

        tip_index = layer.tips(hideTagValue, $(this), {
            tips: 1,//[1, "rgba(0, 0, 0,0.5)"],
            time: 5000,
            skin: 'hideTag-class'
        });
    }).on('mouseleave', this, function(){
        layer.close(tip_index);
    });
    function checkAuth(obj){
       var id=$(obj).data("id");
        $.ajax({
            type: "post",
            url: ctx+"forum/question/checkAuth/"+id,
            data: null,
            async:false,
            xhrFields: {
                withCredentials: true
            },
            dataType: "json",
            success: function(data) {
                if(data.code==0||data.code=='0'){
                    return true;
                }else{
                    Fast.msg_error(data.msg);
                    $(obj).removeAttr("href");
                    return false;
                }
            }
        })
    }
    function openAddQuestion(){
        if(isLogin=='false'){
            openLoginWindow();
            return;
        }
        window.location.href=ctx+"uploadQuestion"
    }

</script>


</body>
</html>